<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Navo Portable Library: navo/algorithm/linear/linked/dclnk.h源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- 制作者 Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Navo Portable Library&#160;<span id="projectnumber">Ver 1.0.20120827</span></div>
   <div id="projectbrief">Provides generic platform independent facilities.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="modules.html"><span>模块</span></a></li>
      <li><a href="annotated.html"><span>数据结构</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>全局定义</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>navo/algorithm/linear/linked/dclnk.h</h1>  </div>
</div>
<div class="contents">
<a href="dclnk_8h.html">浏览该文件的文档。</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */</span>
<a name="l00011"></a>00011 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* #ifdef _MSC_VER */</span>
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="preprocessor">#ifndef __NV_DCLNK__</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define __NV_DCLNK__</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;<a class="code" href="cdef_8h.html" title="Definitions and declarations for common constants, types, variables.">../../../port/cdef.h</a>&quot;</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00022"></a>00022 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l00023"></a>00023 
<a name="l00040"></a><a class="code" href="struct____dclnk__node.html">00040</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct____dclnk__node.html" title="双向环形链表节点">__dclnk_node</a> {
<a name="l00042"></a><a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0">00042</a>     <span class="keyword">struct </span><a class="code" href="struct____dclnk__node.html" title="双向环形链表节点">__dclnk_node</a>* <a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>;
<a name="l00044"></a><a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10">00044</a>     <span class="keyword">struct </span><a class="code" href="struct____dclnk__node.html" title="双向环形链表节点">__dclnk_node</a>* <a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>;
<a name="l00045"></a>00045 }<a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga8b3c7d9077f85a9627a2c316fdc714a4" title="节点">dclnk_node</a>, <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2f086cf3698843abcfd4e5443ba871cb" title="表头">dclnk_head</a>, *<a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga86953fe272bdfdf279a801822e8c681f" title="迭代器">dclnk_iter</a>;
<a name="l00046"></a>00046 
<a name="l00055"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2ac679bd075153564b01c94efc019796">00055</a> <span class="preprocessor">#define DCLNK_HEAD(name) dclnk_head name = {&amp;(name), &amp;(name)}</span>
<a name="l00056"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf9fed193ae8d815185d003de2f3adead">00056</a> <span class="preprocessor"></span><span class="preprocessor">#define DCLNK_NODE(name) dclnk_node name = {&amp;(name), &amp;(name)}</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span>
<a name="l00064"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga432620df92f8f8be4ac3682ae48f63bf">00064</a> <span class="keyword">typedef</span> int (*<a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga432620df92f8f8be4ac3682ae48f63bf" title="单参数回调函数指针">dclnk_pr1</a>)(<a class="code" href="struct____dclnk__node.html" title="双向环形链表节点">dclnk_node</a>*);
<a name="l00065"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga505b299d4cb77893f37a34949dda12b3">00065</a> <span class="keyword">typedef</span> int (*<a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga505b299d4cb77893f37a34949dda12b3" title="双参数回调函数指针">dclnk_pr2</a>)(<a class="code" href="struct____dclnk__node.html" title="双向环形链表节点">dclnk_node</a>*, dclnk_node*);
<a name="l00066"></a>00066 
<a name="l00080"></a>00080 NV_API <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gad1423b930d6c464d2ac3bb12544bc27d" title="判断链表结构是否正常">dclnk_check</a>(dclnk_head* head, dclnk_iter* loop_entry);
<a name="l00081"></a>00081 
<a name="l00082"></a>00082 <span class="preprocessor">#define DCLNK_CHECK_PASS    0 </span><span class="comment">/* 正常 */</span>
<a name="l00083"></a>00083 <span class="preprocessor">#define DCLNK_CHECK_LOOP    1 </span><span class="comment">/* 有非法环路 */</span>
<a name="l00084"></a>00084 <span class="preprocessor">#define DCLNK_CHECK_NULL    2 </span><span class="comment">/* 有节点指向NULL */</span>
<a name="l00085"></a>00085 <span class="preprocessor">#define DCLNK_CHECK_LINK    3 </span><span class="comment">/* 有节点的前驱指针不正确 */</span>
<a name="l00086"></a>00086 
<a name="l00098"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae9455cefe1552511a331da823887dfaa">00098</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae9455cefe1552511a331da823887dfaa" title="初始化表头">dclnk_init</a>(dclnk_head* head)
<a name="l00099"></a>00099 {
<a name="l00100"></a>00100     head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a> = head;
<a name="l00101"></a>00101     head-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a> = head;
<a name="l00102"></a>00102 }
<a name="l00103"></a>00103 
<a name="l00118"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gabacadadbd8582d69f3f20863b08f6328">00118</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gabacadadbd8582d69f3f20863b08f6328" title="判断表是否为空">dclnk_empty</a>(dclnk_head* head)
<a name="l00119"></a>00119 {
<a name="l00120"></a>00120     <span class="keywordflow">return</span> head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a> == head;
<a name="l00121"></a>00121 }
<a name="l00122"></a>00122 
<a name="l00123"></a>00123 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> __dclnk_singular(dclnk_node* front, dclnk_node* end)
<a name="l00124"></a>00124 {
<a name="l00125"></a>00125     <span class="keywordflow">return</span> (front != end &amp;&amp; front-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a> == end);
<a name="l00126"></a>00126 }
<a name="l00127"></a>00127 
<a name="l00142"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaced72da34e1eab3d113981450be479e0">00142</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaced72da34e1eab3d113981450be479e0" title="判断表是否只有单个节点">dclnk_singular</a>(dclnk_head* head)
<a name="l00143"></a>00143 {
<a name="l00144"></a>00144     <span class="keywordflow">return</span> __dclnk_singular(head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>, head);
<a name="l00145"></a>00145 }
<a name="l00146"></a>00146 
<a name="l00169"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga625abc40f57fd4e8c00e9b64fa095435">00169</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga625abc40f57fd4e8c00e9b64fa095435" title="判断表是否可以排序">dclnk_sortable</a>(dclnk_iter begin, dclnk_iter end)
<a name="l00170"></a>00170 {
<a name="l00171"></a>00171     <span class="keywordflow">return</span> (begin != end &amp;&amp; begin-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a> != end);
<a name="l00172"></a>00172 }
<a name="l00173"></a>00173 
<a name="l00203"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga377d3abdd5a7deaf0ba75ddd6391a908">00203</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga377d3abdd5a7deaf0ba75ddd6391a908" title="判断表是否可以序列化">dclnk_serialable</a>(dclnk_head* head)
<a name="l00204"></a>00204 {
<a name="l00205"></a>00205     <span class="keywordflow">return</span> !!head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>;
<a name="l00206"></a>00206 }
<a name="l00207"></a>00207 
<a name="l00215"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4ad181b1f8cf42e5e3ff3e9c623f22fc">00215</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4ad181b1f8cf42e5e3ff3e9c623f22fc" title="链接两个节点">dclnk_link</a>(dclnk_iter <a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, dclnk_iter <a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>)
<a name="l00216"></a>00216 {   <span class="comment">/* 强制连接prev节点和next节点</span>
<a name="l00217"></a>00217 <span class="comment">     * --(prev)-&gt; &lt;-(next)-- ==&gt; --(prev)--(next)--</span>
<a name="l00218"></a>00218 <span class="comment">     */</span>
<a name="l00219"></a>00219     next-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a> = <a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>;
<a name="l00220"></a>00220     prev-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a> = <a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>;
<a name="l00221"></a>00221 }
<a name="l00222"></a>00222 
<a name="l00234"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae94eb1f1c4deac0da3205273c0efdad1">00234</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae94eb1f1c4deac0da3205273c0efdad1" title="在两个节点之间插入一个新节点">dclnk_insert_between</a>(dclnk_node* newly, 
<a name="l00235"></a>00235                                                 dclnk_iter <a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, 
<a name="l00236"></a>00236                                                 dclnk_iter <a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>)
<a name="l00237"></a>00237 {   <span class="comment">/* 强制连接prev节点和next节点，并在两者之间插入newly节点</span>
<a name="l00238"></a>00238 <span class="comment">     * (1) prev节点和next节点原来未连接 </span>
<a name="l00239"></a>00239 <span class="comment">     *       (newly)</span>
<a name="l00240"></a>00240 <span class="comment">     *                   ===&gt; --(prev)-(newly)-(next)--</span>
<a name="l00241"></a>00241 <span class="comment">     * --(prev) (next)--</span>
<a name="l00242"></a>00242 <span class="comment">     * (2) prev节点和next节点原来已连接 </span>
<a name="l00243"></a>00243 <span class="comment">     *       (newly)</span>
<a name="l00244"></a>00244 <span class="comment">     *                   ===&gt; --(prev)-(newly)-(next)--</span>
<a name="l00245"></a>00245 <span class="comment">     * --(prev)-(next)--</span>
<a name="l00246"></a>00246 <span class="comment">     */</span>
<a name="l00247"></a>00247     prev-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a> = newly;
<a name="l00248"></a>00248     next-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a> = newly;
<a name="l00249"></a>00249     newly-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a> = <a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>;
<a name="l00250"></a>00250     newly-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a> = <a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>;
<a name="l00251"></a>00251     <span class="comment">/* 上面的是性能优化后的版本，实际过程同下：</span>
<a name="l00252"></a>00252 <span class="comment">     * dclnk_link(prev, newly);</span>
<a name="l00253"></a>00253 <span class="comment">     * dclnk_link(newly, next);</span>
<a name="l00254"></a>00254 <span class="comment">     *</span>
<a name="l00255"></a>00255 <span class="comment">     * (1)连接prev节点与newly节点  (2)再连接newly节点与next节点</span>
<a name="l00256"></a>00256 <span class="comment">     *          (newly)                    (newly)</span>
<a name="l00257"></a>00257 <span class="comment">     *          /                          /    \</span>
<a name="l00258"></a>00258 <span class="comment">     *    --(prev)  (next)--         --(prev)  (next)--</span>
<a name="l00259"></a>00259 <span class="comment">     */</span>
<a name="l00260"></a>00260 }
<a name="l00261"></a>00261 
<a name="l00276"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3aec4f68e74e315887a21a81787866ec">00276</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3aec4f68e74e315887a21a81787866ec" title="插入节点到指定位置">dclnk_insert</a>(dclnk_iter pos, dclnk_node* newly)
<a name="l00277"></a>00277 {
<a name="l00278"></a>00278     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae94eb1f1c4deac0da3205273c0efdad1" title="在两个节点之间插入一个新节点">dclnk_insert_between</a>(newly, pos-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, pos);
<a name="l00279"></a>00279 }
<a name="l00280"></a>00280 
<a name="l00297"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga54290e7f005a3a8aa376af933aff5c15">00297</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga54290e7f005a3a8aa376af933aff5c15" title="擦除节点">dclnk_erase</a>(dclnk_iter entry)
<a name="l00298"></a>00298 {   <span class="comment">/* 将entry节点从表中移除</span>
<a name="l00299"></a>00299 <span class="comment">     *                        (entry)</span>
<a name="l00300"></a>00300 <span class="comment">     *  -()-(entry)-()- ===&gt; </span>
<a name="l00301"></a>00301 <span class="comment">     *                       --()--()--</span>
<a name="l00302"></a>00302 <span class="comment">     */</span>
<a name="l00303"></a>00303     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4ad181b1f8cf42e5e3ff3e9c623f22fc" title="链接两个节点">dclnk_link</a>(entry-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, entry-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>);
<a name="l00304"></a>00304 }
<a name="l00305"></a>00305 
<a name="l00306"></a>00306 NV_API <span class="keywordtype">void</span> __dclnk_free(dclnk_iter begin, dclnk_iter end, 
<a name="l00307"></a>00307                         <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga432620df92f8f8be4ac3682ae48f63bf" title="单参数回调函数指针">dclnk_pr1</a> erase_handler);
<a name="l00308"></a>00308 
<a name="l00319"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga78e459a9830ebf4f94244c5f86f64007">00319</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga78e459a9830ebf4f94244c5f86f64007" title="清空区域">dclnk_erases</a>(dclnk_iter begin, 
<a name="l00320"></a>00320                             dclnk_iter end, <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga432620df92f8f8be4ac3682ae48f63bf" title="单参数回调函数指针">dclnk_pr1</a> erase_handler)
<a name="l00321"></a>00321 {
<a name="l00322"></a>00322     dclnk_iter <a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a> = begin-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>;
<a name="l00323"></a>00323     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4ad181b1f8cf42e5e3ff3e9c623f22fc" title="链接两个节点">dclnk_link</a>(prev, end);
<a name="l00324"></a>00324     <span class="keywordflow">if</span> (erase_handler)
<a name="l00325"></a>00325         __dclnk_free(begin, end, erase_handler);
<a name="l00326"></a>00326 }
<a name="l00327"></a>00327 
<a name="l00336"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae5307c1791a409caa2dca5336269c0ae">00336</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae5307c1791a409caa2dca5336269c0ae" title="清空表">dclnk_clear</a>(dclnk_head* head, <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga432620df92f8f8be4ac3682ae48f63bf" title="单参数回调函数指针">dclnk_pr1</a> erase_handler)
<a name="l00337"></a>00337 {
<a name="l00338"></a>00338     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga78e459a9830ebf4f94244c5f86f64007" title="清空区域">dclnk_erases</a>(head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>, head, erase_handler);
<a name="l00339"></a>00339 }
<a name="l00340"></a>00340 
<a name="l00347"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gafac002b8ed02d7bc5d0a65343885a6b6">00347</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gafac002b8ed02d7bc5d0a65343885a6b6" title="在表首添加节点">dclnk_push_front</a>(dclnk_head* head, dclnk_node* newly)
<a name="l00348"></a>00348 {
<a name="l00349"></a>00349     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae94eb1f1c4deac0da3205273c0efdad1" title="在两个节点之间插入一个新节点">dclnk_insert_between</a>(newly, head, head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>);
<a name="l00350"></a>00350 }
<a name="l00351"></a>00351 
<a name="l00358"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga53f3bb8691c7fed9ae0ad8c00d2f16a5">00358</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga53f3bb8691c7fed9ae0ad8c00d2f16a5" title="在表尾添加节点">dclnk_push_back</a>(dclnk_head* head, dclnk_node* newly)
<a name="l00359"></a>00359 {
<a name="l00360"></a>00360     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae94eb1f1c4deac0da3205273c0efdad1" title="在两个节点之间插入一个新节点">dclnk_insert_between</a>(newly, head-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, head);
<a name="l00361"></a>00361 }
<a name="l00362"></a>00362 
<a name="l00368"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaadc0edbfff468d99bf4def46b9199ba6">00368</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaadc0edbfff468d99bf4def46b9199ba6" title="移除表首节点">dclnk_pop_front</a>(dclnk_head* head)
<a name="l00369"></a>00369 {
<a name="l00370"></a>00370     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4ad181b1f8cf42e5e3ff3e9c623f22fc" title="链接两个节点">dclnk_link</a>(head, head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>);
<a name="l00371"></a>00371 }
<a name="l00372"></a>00372 
<a name="l00378"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gafb39540ec6ad4ace0a4d62d415c85a19">00378</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gafb39540ec6ad4ace0a4d62d415c85a19" title="移除表尾节点">dclnk_pop_back</a>(dclnk_head* head)
<a name="l00379"></a>00379 {
<a name="l00380"></a>00380     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4ad181b1f8cf42e5e3ff3e9c623f22fc" title="链接两个节点">dclnk_link</a>(head-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, head);
<a name="l00381"></a>00381 }
<a name="l00382"></a>00382 
<a name="l00398"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga75733d92e80fbfc79f4fc56f0b124c4e">00398</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga75733d92e80fbfc79f4fc56f0b124c4e" title="在两个节点之间插入多个连续节点">dclnk_splice_between</a>(
<a name="l00399"></a>00399     dclnk_iter <a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, dclnk_iter <a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>, 
<a name="l00400"></a>00400     dclnk_iter first_prev, dclnk_iter first, 
<a name="l00401"></a>00401     dclnk_iter last, dclnk_iter last_next)
<a name="l00402"></a>00402 {   <span class="comment">/* 将first节点至last节点的部分从旧表(B表)移接到新表(A表)中 </span>
<a name="l00403"></a>00403 <span class="comment">     * (从first到last是按next方向)</span>
<a name="l00404"></a>00404 <span class="comment">     * A:  -(prev)-(next)-      </span>
<a name="l00405"></a>00405 <span class="comment">     * B: -(first_prev)-(first)-...-(last)-(last_next)-</span>
<a name="l00406"></a>00406 <span class="comment">     * to:</span>
<a name="l00407"></a>00407 <span class="comment">     * A: -(prev)-(first)-...-(last)-(next)-</span>
<a name="l00408"></a>00408 <span class="comment">     * B: -(first_prev)-(last_next)-</span>
<a name="l00409"></a>00409 <span class="comment">     */</span>
<a name="l00410"></a>00410     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4ad181b1f8cf42e5e3ff3e9c623f22fc" title="链接两个节点">dclnk_link</a>(last, next);
<a name="l00411"></a>00411     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4ad181b1f8cf42e5e3ff3e9c623f22fc" title="链接两个节点">dclnk_link</a>(prev, first);
<a name="l00412"></a>00412     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4ad181b1f8cf42e5e3ff3e9c623f22fc" title="链接两个节点">dclnk_link</a>(first_prev, last_next);
<a name="l00413"></a>00413 }
<a name="l00414"></a>00414 
<a name="l00431"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gada26a43a4037c0a216fdf79c83cd2baf">00431</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gada26a43a4037c0a216fdf79c83cd2baf" title="在两个节点之间插入多个连续节点">dclnk_splice</a>(dclnk_iter pos, 
<a name="l00432"></a>00432                         dclnk_iter first, dclnk_iter last)
<a name="l00433"></a>00433 {
<a name="l00434"></a>00434     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga75733d92e80fbfc79f4fc56f0b124c4e" title="在两个节点之间插入多个连续节点">dclnk_splice_between</a>(pos-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, pos, first-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, first, last, last-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>);
<a name="l00435"></a>00435 }
<a name="l00436"></a>00436 
<a name="l00443"></a>00443 NV_API <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa4d3dc1196aa9fe3c0c044503323ac15" title="统计表的节点数量">dclnk_count</a>(dclnk_head* head);
<a name="l00444"></a>00444 
<a name="l00453"></a>00453 NV_API <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga0de88342e30ab0e6a95b648f641c82c1" title="计算两个节点的迭代距离">dclnk_distance</a>(dclnk_iter first, dclnk_iter last);
<a name="l00454"></a>00454 
<a name="l00463"></a>00463 NV_API dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga221a07d76e225d9f30e664bd95a5fcd8" title="给迭代器增加一段距离或减小一段距离">dclnk_advance</a>(dclnk_head* head, dclnk_iter cur, <span class="keywordtype">int</span> dist);
<a name="l00464"></a>00464 
<a name="l00472"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gad47975ec126fcb95e697450d8f83d1b7">00472</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gad47975ec126fcb95e697450d8f83d1b7" title="根据正向索引得到迭代器">dclnk_at</a>(dclnk_head* head, <span class="keyword">const</span> <span class="keywordtype">size_t</span> index)
<a name="l00473"></a>00473 {
<a name="l00474"></a>00474     <span class="keywordflow">return</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga221a07d76e225d9f30e664bd95a5fcd8" title="给迭代器增加一段距离或减小一段距离">dclnk_advance</a>(head, head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>, index);
<a name="l00475"></a>00475 }
<a name="l00476"></a>00476 
<a name="l00485"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga5f7f38b76e8bac973050370a0344c84c">00485</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga5f7f38b76e8bac973050370a0344c84c" title="根据逆向索引得到迭代器">dclnk_reverse_at</a>(dclnk_head* head, 
<a name="l00486"></a>00486                                             <span class="keyword">const</span> <span class="keywordtype">size_t</span> index)
<a name="l00487"></a>00487 {
<a name="l00488"></a>00488     <span class="keywordflow">return</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga221a07d76e225d9f30e664bd95a5fcd8" title="给迭代器增加一段距离或减小一段距离">dclnk_advance</a>(head, head-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, -((<span class="keywordtype">int</span>)index));
<a name="l00489"></a>00489 }
<a name="l00490"></a>00490 
<a name="l00498"></a>00498 NV_API <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf73d46da1ca836dfd1a708f5c35122bc" title="计算迭代器的正向索引">dclnk_index_of</a>(dclnk_head* head, dclnk_iter itr);
<a name="l00499"></a>00499 
<a name="l00507"></a>00507 NV_API <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf54726f41db556629a3c54dcede5a9f2" title="计算迭代器的逆向索引">dclnk_reverse_index_of</a>(dclnk_head* head, dclnk_iter itr);
<a name="l00508"></a>00508 
<a name="l00514"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3c3c7474d2f624c8dc7bcc7925d60a87">00514</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3c3c7474d2f624c8dc7bcc7925d60a87" title="初始化节点">dclnk_node_init</a>(dclnk_node* entry)
<a name="l00515"></a>00515 {
<a name="l00516"></a>00516     entry-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a> = entry;
<a name="l00517"></a>00517     entry-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a> = entry;
<a name="l00518"></a>00518 }
<a name="l00519"></a>00519 
<a name="l00527"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga077ff3ad59d6bfea0fade064d318480c">00527</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga077ff3ad59d6bfea0fade064d318480c" title="用新节点替换目标节点">dclnk_iter_replace</a>(dclnk_node* victim, dclnk_node* newly)
<a name="l00528"></a>00528 {   <span class="comment">/* 用newly节点替换表中的victim节点</span>
<a name="l00529"></a>00529 <span class="comment">     *      (newly)                 (victim)</span>
<a name="l00530"></a>00530 <span class="comment">     *                    ===&gt;</span>
<a name="l00531"></a>00531 <span class="comment">     * --()-(victim)-()--      --()-(newly)-()--</span>
<a name="l00532"></a>00532 <span class="comment">     */</span>
<a name="l00533"></a>00533     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae94eb1f1c4deac0da3205273c0efdad1" title="在两个节点之间插入一个新节点">dclnk_insert_between</a>(newly, victim-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, victim-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>);
<a name="l00534"></a>00534 }
<a name="l00535"></a>00535 
<a name="l00536"></a>00536 NV_API <span class="keywordtype">void</span> __dclnk_iter_swap(
<a name="l00537"></a>00537     dclnk_iter aprev, dclnk_iter a, dclnk_iter anext, 
<a name="l00538"></a>00538     dclnk_iter bprev, dclnk_iter b, dclnk_iter bnext);
<a name="l00539"></a>00539 
<a name="l00546"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga1b46f8add85b96289a18c71c67ad9c29">00546</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga1b46f8add85b96289a18c71c67ad9c29" title="交换两个节点">dclnk_iter_swap</a>(dclnk_iter a, dclnk_iter b)
<a name="l00547"></a>00547 {
<a name="l00548"></a>00548     __dclnk_iter_swap(a-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, a, a-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>, b-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, b, b-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>);
<a name="l00549"></a>00549 }
<a name="l00550"></a>00550 
<a name="l00557"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2753cb5c697b104f8c0c53b0fb6bf44d">00557</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2753cb5c697b104f8c0c53b0fb6bf44d" title="用新表头替换目标表头">dclnk_replace</a>(dclnk_head* victim, dclnk_head* newly)
<a name="l00558"></a>00558 {   <span class="comment">/* 用newly头替换表中的victim头</span>
<a name="l00559"></a>00559 <span class="comment">     *      [newly]                 [victim]</span>
<a name="l00560"></a>00560 <span class="comment">     *                    ===&gt;</span>
<a name="l00561"></a>00561 <span class="comment">     * --()-[victim]-()--      --()-[newly]-()--</span>
<a name="l00562"></a>00562 <span class="comment">     */</span>
<a name="l00563"></a>00563     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae94eb1f1c4deac0da3205273c0efdad1" title="在两个节点之间插入一个新节点">dclnk_insert_between</a>(newly, victim-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, victim-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>);
<a name="l00564"></a>00564 }
<a name="l00565"></a>00565 
<a name="l00566"></a>00566 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __dclnk_swap(
<a name="l00567"></a>00567     dclnk_iter aback, dclnk_iter a, dclnk_iter afront, 
<a name="l00568"></a>00568     dclnk_iter bback, dclnk_iter b, dclnk_iter bfront)
<a name="l00569"></a>00569 {   <span class="comment">/* 交换a、b两个头</span>
<a name="l00570"></a>00570 <span class="comment">     * --(aback)-[a]-(afront)--       --(aback)-[b]-(afront)--</span>
<a name="l00571"></a>00571 <span class="comment">     *                         ===&gt;</span>
<a name="l00572"></a>00572 <span class="comment">     * --(bback)-[b]-(bfront)--       --(bback)-[a]-(afront)--</span>
<a name="l00573"></a>00573 <span class="comment">     */</span>
<a name="l00574"></a>00574     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae94eb1f1c4deac0da3205273c0efdad1" title="在两个节点之间插入一个新节点">dclnk_insert_between</a>(b, aback, afront);
<a name="l00575"></a>00575     <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae94eb1f1c4deac0da3205273c0efdad1" title="在两个节点之间插入一个新节点">dclnk_insert_between</a>(a, bback, bfront);
<a name="l00576"></a>00576 }
<a name="l00577"></a>00577 
<a name="l00584"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga655dec9de6ff78ba650545f4fd0cf25c">00584</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga655dec9de6ff78ba650545f4fd0cf25c" title="交换两个表头">dclnk_swap</a>(dclnk_head* a, dclnk_head* b)
<a name="l00585"></a>00585 {
<a name="l00586"></a>00586     __dclnk_swap(a-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, a, a-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>, b-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>, b, b-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>);
<a name="l00587"></a>00587 }
<a name="l00588"></a>00588 
<a name="l00598"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gad846825e029928eb6175a9950e9c2835">00598</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gad846825e029928eb6175a9950e9c2835" title="判断一个节点是否存在于表中">dclnk_exist</a>(dclnk_head* head, dclnk_iter itr)
<a name="l00599"></a>00599 {
<a name="l00600"></a>00600     <span class="keywordflow">return</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf73d46da1ca836dfd1a708f5c35122bc" title="计算迭代器的正向索引">dclnk_index_of</a>(head, itr) != (size_t)(-1);
<a name="l00601"></a>00601 }
<a name="l00602"></a>00602 
<a name="l00610"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa4ddc5dca3168a9e3b3988ae7c907ae6">00610</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa4ddc5dca3168a9e3b3988ae7c907ae6" title="得到表首节点">dclnk_front</a>(dclnk_head* head)
<a name="l00611"></a>00611 {
<a name="l00612"></a>00612     <span class="keywordflow">return</span> head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>;
<a name="l00613"></a>00613 }
<a name="l00614"></a>00614 
<a name="l00622"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga64297f541720c79ce293bfee872c4e55">00622</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga64297f541720c79ce293bfee872c4e55" title="得到表尾节点">dclnk_back</a>(dclnk_head* head)
<a name="l00623"></a>00623 {
<a name="l00624"></a>00624     <span class="keywordflow">return</span> head-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>;
<a name="l00625"></a>00625 }
<a name="l00626"></a>00626 
<a name="l00645"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga775a15538846de23d715ba0bf3afa3a5">00645</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga775a15538846de23d715ba0bf3afa3a5" title="得到指向正向起始位置的迭代器">dclnk_begin</a>(dclnk_head* head)
<a name="l00646"></a>00646 {
<a name="l00647"></a>00647     <span class="keywordflow">return</span> head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>;
<a name="l00648"></a>00648 }
<a name="l00649"></a>00649 
<a name="l00657"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga7ba5dcacaa98db4d65f82ac7892513f0">00657</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga7ba5dcacaa98db4d65f82ac7892513f0" title="得到指向正向终止位置的迭代器">dclnk_end</a>(dclnk_head* head)
<a name="l00658"></a>00658 {
<a name="l00659"></a>00659     <span class="keywordflow">return</span> head;
<a name="l00660"></a>00660 }
<a name="l00661"></a>00661 
<a name="l00669"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga9c6a5a5d5c387591c119756e21479e86">00669</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga9c6a5a5d5c387591c119756e21479e86" title="得到当前迭代器的正向终止位置">dclnk_end_of</a>(dclnk_iter itr)
<a name="l00670"></a>00670 {
<a name="l00671"></a>00671     <span class="keywordflow">return</span> itr-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>;
<a name="l00672"></a>00672 }
<a name="l00673"></a>00673 
<a name="l00692"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2ec16ec1678a27ac0b87166c3ab10288">00692</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2ec16ec1678a27ac0b87166c3ab10288" title="得到指向逆向起始位置的迭代器">dclnk_rbegin</a>(dclnk_head* head)
<a name="l00693"></a>00693 {
<a name="l00694"></a>00694     <span class="keywordflow">return</span> head-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>;
<a name="l00695"></a>00695 }
<a name="l00696"></a>00696 
<a name="l00704"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga42269157f5db93f73fd5eeb42d34d1d9">00704</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga42269157f5db93f73fd5eeb42d34d1d9" title="得到指向逆向终止位置的迭代器">dclnk_rend</a>(dclnk_head* head)
<a name="l00705"></a>00705 {
<a name="l00706"></a>00706     <span class="keywordflow">return</span> head;
<a name="l00707"></a>00707 }
<a name="l00708"></a>00708 
<a name="l00716"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2cc91af5ec84d64b019be9c0023c2aa8">00716</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2cc91af5ec84d64b019be9c0023c2aa8" title="得到当前迭代器的逆向终止位置">dclnk_rend_of</a>(dclnk_iter itr)
<a name="l00717"></a>00717 {
<a name="l00718"></a>00718     <span class="keywordflow">return</span> itr-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>;
<a name="l00719"></a>00719 }
<a name="l00720"></a>00720 
<a name="l00728"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga5699b2d9bb2082637b80d7ee473bd00e">00728</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga5699b2d9bb2082637b80d7ee473bd00e" title="得到当前节点的后继节点">dclnk_next</a>(dclnk_iter itr)
<a name="l00729"></a>00729 {
<a name="l00730"></a>00730     <span class="keywordflow">return</span> itr-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>;
<a name="l00731"></a>00731 }
<a name="l00732"></a>00732 
<a name="l00740"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gac9747211a6b24a7c38fd92f43f35ad0d">00740</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gac9747211a6b24a7c38fd92f43f35ad0d" title="得到当前节点的前驱节点">dclnk_prev</a>(dclnk_iter itr)
<a name="l00741"></a>00741 {
<a name="l00742"></a>00742     <span class="keywordflow">return</span> itr-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>;
<a name="l00743"></a>00743 }
<a name="l00744"></a>00744 
<a name="l00745"></a>00745 <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter __dclnk_inc_later(dclnk_iter cur, dclnk_iter* p)
<a name="l00746"></a>00746 {
<a name="l00747"></a>00747     *p = cur-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>;
<a name="l00748"></a>00748     <span class="keywordflow">return</span> cur;
<a name="l00749"></a>00749 }
<a name="l00750"></a>00750 
<a name="l00751"></a>00751 <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter __dclnk_dec_later(dclnk_iter cur, dclnk_iter* p)
<a name="l00752"></a>00752 {
<a name="l00753"></a>00753     *p = cur-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a>;
<a name="l00754"></a>00754     <span class="keywordflow">return</span> cur;
<a name="l00755"></a>00755 }
<a name="l00756"></a>00756 
<a name="l00767"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaea2c7c56280acea09dafcba1aba02bb5">00767</a> <span class="preprocessor">#define dclnk_inc(itr) ((itr) = (itr)-&gt;next)</span>
<a name="l00768"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaedd9b66da5685e28f99eeaecc34d3c8c">00768</a> <span class="preprocessor"></span><span class="preprocessor">#define dclnk_dec(itr) ((itr) = (itr)-&gt;prev)</span>
<a name="l00769"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga098729f5dc47317dc9c20a257f2420a6">00769</a> <span class="preprocessor"></span><span class="preprocessor">#define dclnk_inc_later(itr) __dclnk_inc_later(itr, &amp;(itr))</span>
<a name="l00770"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga6f85ce98aaca29c277b1eff0b69f8207">00770</a> <span class="preprocessor"></span><span class="preprocessor">#define dclnk_dec_later(itr) __dclnk_dec_later(itr, &amp;(itr))</span>
<a name="l00771"></a>00771 <span class="preprocessor"></span>
<a name="l00781"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa7e5b16b5001b0eded03230bb177dc72">00781</a> <span class="preprocessor">#define dclnk_foreach(_begin, _end, fn, type, member) do {      \</span>
<a name="l00782"></a>00782 <span class="preprocessor">        dclnk_iter _q_e = (_end);                               \</span>
<a name="l00783"></a>00783 <span class="preprocessor">        dclnk_iter _q_f = (_begin);                             \</span>
<a name="l00784"></a>00784 <span class="preprocessor">        while (_q_f != _q_e) {                                  \</span>
<a name="l00785"></a>00785 <span class="preprocessor">            type * _q_t = container_of(_q_f, type, member);     \</span>
<a name="l00786"></a>00786 <span class="preprocessor">            _q_f = _q_f-&gt;next;                                  \</span>
<a name="l00787"></a>00787 <span class="preprocessor">            fn(_q_t);                                           \</span>
<a name="l00788"></a>00788 <span class="preprocessor">        }                                                       \</span>
<a name="l00789"></a>00789 <span class="preprocessor">    } while (0)</span>
<a name="l00790"></a>00790 <span class="preprocessor"></span>
<a name="l00800"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gac2f2e83ed209c8b3a0e72c9f1bc0badb">00800</a> <span class="preprocessor">#define dclnk_reverse_foreach(_rbegin, _rend, fn, type, member) \</span>
<a name="l00801"></a>00801 <span class="preprocessor">    do {dclnk_iter _q_e = (_rend);                              \</span>
<a name="l00802"></a>00802 <span class="preprocessor">        dclnk_iter _q_f = (_rbegin);                            \</span>
<a name="l00803"></a>00803 <span class="preprocessor">        while (_q_f != _q_e) {                                  \</span>
<a name="l00804"></a>00804 <span class="preprocessor">            type * _q_t = container_of(_q_f, type, member);     \</span>
<a name="l00805"></a>00805 <span class="preprocessor">            _q_f = _q_f-&gt;prev;                                  \</span>
<a name="l00806"></a>00806 <span class="preprocessor">            fn(_q_t);                                           \</span>
<a name="l00807"></a>00807 <span class="preprocessor">        }                                                       \</span>
<a name="l00808"></a>00808 <span class="preprocessor">    } while (0)</span>
<a name="l00809"></a>00809 <span class="preprocessor"></span>
<a name="l00822"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gada320f937c58069234344b73d25fa548">00822</a> <span class="preprocessor">#define dclnk_search(head, _begin, _end, equal, var, res, type, member) \</span>
<a name="l00823"></a>00823 <span class="preprocessor">    do {dclnk_iter _q_e = (_end);                               \</span>
<a name="l00824"></a>00824 <span class="preprocessor">        dclnk_iter _q_f = (_begin);                             \</span>
<a name="l00825"></a>00825 <span class="preprocessor">        dclnk_head* _q_h = (head);                              \</span>
<a name="l00826"></a>00826 <span class="preprocessor">        (res) = NULL;                                           \</span>
<a name="l00827"></a>00827 <span class="preprocessor">        while (_q_f != _q_e) {                                  \</span>
<a name="l00828"></a>00828 <span class="preprocessor">            type * _q_cb = container_of(_q_f, type, member);    \</span>
<a name="l00829"></a>00829 <span class="preprocessor">            if (unlikely(equal(_q_cb, (val)))) {                \</span>
<a name="l00830"></a>00830 <span class="preprocessor">                (res) = _q_cb;                                  \</span>
<a name="l00831"></a>00831 <span class="preprocessor">                break;                                          \</span>
<a name="l00832"></a>00832 <span class="preprocessor">            }                                                   \</span>
<a name="l00833"></a>00833 <span class="preprocessor">            _q_f = _q_f-&gt;next;                                  \</span>
<a name="l00834"></a>00834 <span class="preprocessor">        }                                                       \</span>
<a name="l00835"></a>00835 <span class="preprocessor">    } while (0)</span>
<a name="l00836"></a>00836 <span class="preprocessor"></span>
<a name="l00837"></a>00837 <span class="comment">/* 反转链表的两种方式：</span>
<a name="l00838"></a>00838 <span class="comment"> * (1) 直接使用 dclnk_reverse(head); (推荐)</span>
<a name="l00839"></a>00839 <span class="comment"> * (2) 按照如下方式迭代</span>
<a name="l00840"></a>00840 <span class="comment"> *     dclnk_iter i = dclnk_vbegin(head);</span>
<a name="l00841"></a>00841 <span class="comment"> *     dclnk_iter e = dclnk_vend(head);</span>
<a name="l00842"></a>00842 <span class="comment"> *     while (i != e) {</span>
<a name="l00843"></a>00843 <span class="comment"> *          dclnk_vpush(head, i);</span>
<a name="l00844"></a>00844 <span class="comment"> *     }</span>
<a name="l00845"></a>00845 <span class="comment"> *     当迭代完成时，反转完成</span>
<a name="l00846"></a>00846 <span class="comment"> */</span>
<a name="l00847"></a>00847 
<a name="l00848"></a>00848 <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter __dclnk_vbegin(dclnk_head* head, dclnk_iter front)
<a name="l00849"></a>00849 {
<a name="l00850"></a>00850     head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a> = head;
<a name="l00851"></a>00851     head-&gt;<a class="code" href="struct____dclnk__node.html#ad6444cb695c4b196b886298f9e21cc10" title="前驱节点">prev</a> = head;
<a name="l00852"></a>00852     <span class="keywordflow">return</span> front;
<a name="l00853"></a>00853 }
<a name="l00854"></a>00854 
<a name="l00871"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga310d89f0377a31ddfec420f54ed43ea1">00871</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga310d89f0377a31ddfec420f54ed43ea1" title="得到用于反转的起始位置的迭代器">dclnk_vbegin</a>(dclnk_head* head)
<a name="l00872"></a>00872 {
<a name="l00873"></a>00873     <span class="keywordflow">return</span> __dclnk_vbegin(head, head-&gt;<a class="code" href="struct____dclnk__node.html#a7fd3e4e933fc09c588ab28b651e471c0" title="后继节点">next</a>);
<a name="l00874"></a>00874 }
<a name="l00875"></a>00875 
<a name="l00892"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga7e058f07e0740f7f810abe5305472a02">00892</a> <span class="keyword">static</span> <span class="keyword">inline</span> dclnk_iter <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga7e058f07e0740f7f810abe5305472a02" title="得到用于反转的终止位置的迭代器">dclnk_vend</a>(dclnk_head* head)
<a name="l00893"></a>00893 {
<a name="l00894"></a>00894     <span class="keywordflow">return</span> head;
<a name="l00895"></a>00895 }
<a name="l00896"></a>00896 
<a name="l00913"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gadc0e328a4ae2283c8804107510b8b494">00913</a> <span class="preprocessor">#define dclnk_vpush(head, itr) dclnk_push_front(head, dclnk_inc_later(itr))</span>
<a name="l00914"></a>00914 <span class="preprocessor"></span>
<a name="l00921"></a>00921 NV_API <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gadffbb5e0d816b360d559414d9f96f5cf" title="反转表">dclnk_reverse</a>(dclnk_head* head);
<a name="l00922"></a>00922 
<a name="l00923"></a>00923 NV_API <span class="keywordtype">void</span> __dclnk_serialize(dclnk_head* head, <span class="keywordtype">char</span>** buf, 
<a name="l00924"></a>00924                             <span class="keyword">const</span> <span class="keywordtype">size_t</span> offset);
<a name="l00925"></a>00925 
<a name="l00926"></a>00926 NV_API <span class="keywordtype">void</span> __dclnk_deserialize(dclnk_head* head, <span class="keywordtype">char</span>** buf, 
<a name="l00927"></a>00927                             <span class="keywordtype">size_t</span> cnt, <span class="keyword">const</span> <span class="keywordtype">size_t</span> offset);
<a name="l00928"></a>00928 
<a name="l00958"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4c8e23b2ed6f6855d4c43b02c0036e12">00958</a> <span class="preprocessor">#define dclnk_serialize(head, buf, type, member) \</span>
<a name="l00959"></a>00959 <span class="preprocessor">    __dclnk_serialize(head, (char**)(buf), offset_of(type, member))</span>
<a name="l00960"></a>00960 <span class="preprocessor"></span>
<a name="l00991"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gae8cc4e2839f2cef62d6fb8925f271308">00991</a> <span class="preprocessor">#define dclnk_deserialize(head, buf, cnt, type, member) \</span>
<a name="l00992"></a>00992 <span class="preprocessor">    __dclnk_deserialize(head, (char**)(buf), cnt, offset_of(type, member))</span>
<a name="l00993"></a>00993 <span class="preprocessor"></span>
<a name="l01005"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga80a398d1d1e86c1794a2eb5f82ed2a71">01005</a> <span class="preprocessor">#define dclnk_sort_insert(head, newly, greater_equal, type, member) \</span>
<a name="l01006"></a>01006 <span class="preprocessor">    do {dclnk_iter _k_n = (newly);                              \</span>
<a name="l01007"></a>01007 <span class="preprocessor">        dclnk_head* _k_h = (head);                              \</span>
<a name="l01008"></a>01008 <span class="preprocessor">        dclnk_iter _k_i = _k_h-&gt;next;                           \</span>
<a name="l01009"></a>01009 <span class="preprocessor">        while (_k_i != _k_h) {                                  \</span>
<a name="l01010"></a>01010 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);    \</span>
<a name="l01011"></a>01011 <span class="preprocessor">            type * _k_pn = container_of(_k_n, type, member);    \</span>
<a name="l01012"></a>01012 <span class="preprocessor">            if (greater_equal(_k_pi, _k_pn))                    \</span>
<a name="l01013"></a>01013 <span class="preprocessor">                break;                                          \</span>
<a name="l01014"></a>01014 <span class="preprocessor">            _k_i = _k_i-&gt;next;                                  \</span>
<a name="l01015"></a>01015 <span class="preprocessor">        }                                                       \</span>
<a name="l01016"></a>01016 <span class="preprocessor">        dclnk_insert(_k_i, _k_n);                               \</span>
<a name="l01017"></a>01017 <span class="preprocessor">    } while (0)</span>
<a name="l01018"></a>01018 <span class="preprocessor"></span>
<a name="l01033"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga2c82cc2f6f97b84452c5c3a2fab2e8db">01033</a> <span class="preprocessor">#define dclnk_is_sorted(_begin, _end, greater_equal, res, type, member) \</span>
<a name="l01034"></a>01034 <span class="preprocessor">    do {dclnk_iter _k_e = (_end);                               \</span>
<a name="l01035"></a>01035 <span class="preprocessor">        dclnk_iter _k_i = (_begin);                             \</span>
<a name="l01036"></a>01036 <span class="preprocessor">        dclnk_iter _k_j = _k_i-&gt;next;                           \</span>
<a name="l01037"></a>01037 <span class="preprocessor">        (res) = 1;                                              \</span>
<a name="l01038"></a>01038 <span class="preprocessor">        while (_k_j != _k_e) {                                  \</span>
<a name="l01039"></a>01039 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);    \</span>
<a name="l01040"></a>01040 <span class="preprocessor">            type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l01041"></a>01041 <span class="preprocessor">            if (!(greater_equal(_k_pj, _k_pi))) {               \</span>
<a name="l01042"></a>01042 <span class="preprocessor">                (res) = 0;                                      \</span>
<a name="l01043"></a>01043 <span class="preprocessor">                break;                                          \</span>
<a name="l01044"></a>01044 <span class="preprocessor">            }                                                   \</span>
<a name="l01045"></a>01045 <span class="preprocessor">            _k_i = _k_j;                                        \</span>
<a name="l01046"></a>01046 <span class="preprocessor">            _k_j = _k_j-&gt;next;                                  \</span>
<a name="l01047"></a>01047 <span class="preprocessor">        }                                                       \</span>
<a name="l01048"></a>01048 <span class="preprocessor">    } while (0)</span>
<a name="l01049"></a>01049 <span class="preprocessor"></span>
<a name="l01050"></a>01050 <span class="comment">/* 双向环形链表排序性能比较</span>
<a name="l01051"></a>01051 <span class="comment"> * 随机数据：(最高) 插入排序 &gt;&gt; 选择排序 &gt;&gt; 冒泡排序 &gt; 鸡尾酒排序 &gt; 奇偶排序 (最低)</span>
<a name="l01052"></a>01052 <span class="comment"> * 顺序数据：(最高) 冒泡排序 &gt; 奇偶排序 &gt; 鸡尾酒排序 &gt;&gt; 插入排序 &gt; 选择排序  (最低)</span>
<a name="l01053"></a>01053 <span class="comment"> * 逆序数据：(最高) 插入排序 &gt;&gt; 选择排序 &gt;&gt; 冒泡排序 &gt; 鸡尾酒排序 &gt; 奇偶排序  (最低)</span>
<a name="l01054"></a>01054 <span class="comment"> */</span>
<a name="l01055"></a>01055 
<a name="l01068"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gacbcd3f2e98eab443214b8360d76b8867">01068</a> <span class="preprocessor">#define dclnk_bubble_sort(_begin, _end, greater, type, member) do { \</span>
<a name="l01069"></a>01069 <span class="preprocessor">        int _k_pc = 1;                                              \</span>
<a name="l01070"></a>01070 <span class="preprocessor">        dclnk_iter _k_e = (_end);                                   \</span>
<a name="l01071"></a>01071 <span class="preprocessor">        dclnk_iter _k_i = (_begin);                                 \</span>
<a name="l01072"></a>01072 <span class="preprocessor">        for (; _k_pc &amp;&amp; _k_i != _k_e; _k_i = _k_i-&gt;next) {          \</span>
<a name="l01073"></a>01073 <span class="preprocessor">            dclnk_iter _k_j = _k_i-&gt;next;                           \</span>
<a name="l01074"></a>01074 <span class="preprocessor">            for (_k_pc = 0; _k_j != _k_e; _k_j = _k_j-&gt;next) {      \</span>
<a name="l01075"></a>01075 <span class="preprocessor">                type * _k_pi = container_of(_k_i, type, member);    \</span>
<a name="l01076"></a>01076 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l01077"></a>01077 <span class="preprocessor">                if (greater(_k_pi, _k_pj)) {                        \</span>
<a name="l01078"></a>01078 <span class="preprocessor">                    dclnk_iter _k_t = _k_i;                         \</span>
<a name="l01079"></a>01079 <span class="preprocessor">                    _k_i = _k_j;                                    \</span>
<a name="l01080"></a>01080 <span class="preprocessor">                    _k_j = _k_t;                                    \</span>
<a name="l01081"></a>01081 <span class="preprocessor">                    dclnk_iter_swap(_k_i, _k_j);                    \</span>
<a name="l01082"></a>01082 <span class="preprocessor">                    _k_pc = 1;                                      \</span>
<a name="l01083"></a>01083 <span class="preprocessor">                }                                                   \</span>
<a name="l01084"></a>01084 <span class="preprocessor">            }                                                       \</span>
<a name="l01085"></a>01085 <span class="preprocessor">        }                                                           \</span>
<a name="l01086"></a>01086 <span class="preprocessor">    } while (0)</span>
<a name="l01087"></a>01087 <span class="preprocessor"></span>
<a name="l01100"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaabc1f7a36fcd57b49548b0e624c0d456">01100</a> <span class="preprocessor">#define dclnk_oddeven_sort(_begin, _end, greater, type, member) do {    \</span>
<a name="l01101"></a>01101 <span class="preprocessor">        int _k_pc = 1;                                                  \</span>
<a name="l01102"></a>01102 <span class="preprocessor">        dclnk_iter _k_e = (_end);                                       \</span>
<a name="l01103"></a>01103 <span class="preprocessor">        dclnk_iter _k_f = (_begin);                                     \</span>
<a name="l01104"></a>01104 <span class="preprocessor">        dclnk_iter _k_p = _k_f-&gt;prev;                                   \</span>
<a name="l01105"></a>01105 <span class="preprocessor">        while (_k_pc) {                                                 \</span>
<a name="l01106"></a>01106 <span class="preprocessor">            _k_pc = 0;                                                  \</span>
<a name="l01107"></a>01107 <span class="preprocessor">            _k_f = _k_p-&gt;next;                                          \</span>
<a name="l01108"></a>01108 <span class="preprocessor">            __dclnk_oddeven_scan(greater, type, member, _k_f);          \</span>
<a name="l01109"></a>01109 <span class="preprocessor">            __dclnk_oddeven_scan(greater, type, member, _k_f-&gt;next);    \</span>
<a name="l01110"></a>01110 <span class="preprocessor">        }                                                               \</span>
<a name="l01111"></a>01111 <span class="preprocessor">    } while (0)</span>
<a name="l01112"></a>01112 <span class="preprocessor"></span>
<a name="l01113"></a>01113 <span class="preprocessor">#define __dclnk_oddeven_scan(greater, type, member, _start) do {    \</span>
<a name="l01114"></a>01114 <span class="preprocessor">        dclnk_iter _k_i = _start;                                   \</span>
<a name="l01115"></a>01115 <span class="preprocessor">        dclnk_iter _k_j = _k_i-&gt;next;                               \</span>
<a name="l01116"></a>01116 <span class="preprocessor">        while (_k_j != _k_e &amp;&amp; _k_i != _k_e) {                      \</span>
<a name="l01117"></a>01117 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);        \</span>
<a name="l01118"></a>01118 <span class="preprocessor">            type * _k_pj = container_of(_k_j, type, member);        \</span>
<a name="l01119"></a>01119 <span class="preprocessor">            if (greater(_k_pi, _k_pj)) {                            \</span>
<a name="l01120"></a>01120 <span class="preprocessor">                dclnk_iter _k_t = _k_i;                             \</span>
<a name="l01121"></a>01121 <span class="preprocessor">                _k_i = _k_j;                                        \</span>
<a name="l01122"></a>01122 <span class="preprocessor">                _k_j = _k_t;                                        \</span>
<a name="l01123"></a>01123 <span class="preprocessor">                dclnk_iter_swap(_k_i, _k_j);                        \</span>
<a name="l01124"></a>01124 <span class="preprocessor">                _k_pc = 1;                                          \</span>
<a name="l01125"></a>01125 <span class="preprocessor">            }                                                       \</span>
<a name="l01126"></a>01126 <span class="preprocessor">            _k_i = _k_j-&gt;next;                                      \</span>
<a name="l01127"></a>01127 <span class="preprocessor">            _k_j = _k_i-&gt;next;                                      \</span>
<a name="l01128"></a>01128 <span class="preprocessor">        }                                                           \</span>
<a name="l01129"></a>01129 <span class="preprocessor">    } while (0)</span>
<a name="l01130"></a>01130 <span class="preprocessor"></span>
<a name="l01143"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga90d6f33948cddcf1d4c0f9337f1337a3">01143</a> <span class="preprocessor">#define dclnk_cocktail_sort(_begin, _end, greater, type, member) do {   \</span>
<a name="l01144"></a>01144 <span class="preprocessor">        int _k_pc = 1;                                                  \</span>
<a name="l01145"></a>01145 <span class="preprocessor">        dclnk_iter _k_e = (_end);                                       \</span>
<a name="l01146"></a>01146 <span class="preprocessor">        dclnk_iter _k_f = (_begin);                                     \</span>
<a name="l01147"></a>01147 <span class="preprocessor">        while (_k_pc) {                                                 \</span>
<a name="l01148"></a>01148 <span class="preprocessor">            dclnk_iter _k_i = _k_f;                                     \</span>
<a name="l01149"></a>01149 <span class="preprocessor">            dclnk_iter _k_j = _k_f-&gt;next;                               \</span>
<a name="l01150"></a>01150 <span class="preprocessor">            _k_pc = 0;                                                  \</span>
<a name="l01151"></a>01151 <span class="preprocessor">            if (_k_j != _k_e) {                                         \</span>
<a name="l01152"></a>01152 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);        \</span>
<a name="l01153"></a>01153 <span class="preprocessor">                type * _k_pi = container_of(_k_i, type, member);        \</span>
<a name="l01154"></a>01154 <span class="preprocessor">                if (greater(_k_pi, _k_pj)) {                            \</span>
<a name="l01155"></a>01155 <span class="preprocessor">                    dclnk_iter _k_t = _k_i;                             \</span>
<a name="l01156"></a>01156 <span class="preprocessor">                    _k_i = _k_j;                                        \</span>
<a name="l01157"></a>01157 <span class="preprocessor">                    _k_f = _k_j;                                        \</span>
<a name="l01158"></a>01158 <span class="preprocessor">                    _k_j = _k_t;                                        \</span>
<a name="l01159"></a>01159 <span class="preprocessor">                    dclnk_iter_swap(_k_i, _k_j);                        \</span>
<a name="l01160"></a>01160 <span class="preprocessor">                    _k_pc = 1;                                          \</span>
<a name="l01161"></a>01161 <span class="preprocessor">                }                                                       \</span>
<a name="l01162"></a>01162 <span class="preprocessor">                _k_i = _k_j;                                            \</span>
<a name="l01163"></a>01163 <span class="preprocessor">                _k_j = _k_j-&gt;next;                                      \</span>
<a name="l01164"></a>01164 <span class="preprocessor">            }                                                           \</span>
<a name="l01165"></a>01165 <span class="preprocessor">            while (_k_j != _k_e) {                                      \</span>
<a name="l01166"></a>01166 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);        \</span>
<a name="l01167"></a>01167 <span class="preprocessor">                type * _k_pi = container_of(_k_i, type, member);        \</span>
<a name="l01168"></a>01168 <span class="preprocessor">                if (greater(_k_pi, _k_pj)) {                            \</span>
<a name="l01169"></a>01169 <span class="preprocessor">                    dclnk_iter _k_t = _k_i;                             \</span>
<a name="l01170"></a>01170 <span class="preprocessor">                    _k_i = _k_j;                                        \</span>
<a name="l01171"></a>01171 <span class="preprocessor">                    _k_j = _k_t;                                        \</span>
<a name="l01172"></a>01172 <span class="preprocessor">                    dclnk_iter_swap(_k_i, _k_j);                        \</span>
<a name="l01173"></a>01173 <span class="preprocessor">                    _k_pc = 1;                                          \</span>
<a name="l01174"></a>01174 <span class="preprocessor">                }                                                       \</span>
<a name="l01175"></a>01175 <span class="preprocessor">                _k_i = _k_j;                                            \</span>
<a name="l01176"></a>01176 <span class="preprocessor">                _k_j = _k_j-&gt;next;                                      \</span>
<a name="l01177"></a>01177 <span class="preprocessor">            }                                                           \</span>
<a name="l01178"></a>01178 <span class="preprocessor">            _k_i = _k_i-&gt;prev;                                          \</span>
<a name="l01179"></a>01179 <span class="preprocessor">            _k_j = _k_i-&gt;prev;                                          \</span>
<a name="l01180"></a>01180 <span class="preprocessor">            _k_f = _k_f-&gt;prev;                                          \</span>
<a name="l01181"></a>01181 <span class="preprocessor">            while (_k_j != _k_f) {                                      \</span>
<a name="l01182"></a>01182 <span class="preprocessor">                type * _k_pi = container_of(_k_i, type, member);        \</span>
<a name="l01183"></a>01183 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);        \</span>
<a name="l01184"></a>01184 <span class="preprocessor">                if (greater(_k_pj, _k_pi)) {                            \</span>
<a name="l01185"></a>01185 <span class="preprocessor">                    dclnk_iter _k_t = _k_i;                             \</span>
<a name="l01186"></a>01186 <span class="preprocessor">                    _k_i = _k_j;                                        \</span>
<a name="l01187"></a>01187 <span class="preprocessor">                    _k_j = _k_t;                                        \</span>
<a name="l01188"></a>01188 <span class="preprocessor">                    dclnk_iter_swap(_k_i, _k_j);                        \</span>
<a name="l01189"></a>01189 <span class="preprocessor">                    _k_pc = 1;                                          \</span>
<a name="l01190"></a>01190 <span class="preprocessor">                }                                                       \</span>
<a name="l01191"></a>01191 <span class="preprocessor">                _k_i = _k_j;                                            \</span>
<a name="l01192"></a>01192 <span class="preprocessor">                _k_j = _k_j-&gt;prev;                                      \</span>
<a name="l01193"></a>01193 <span class="preprocessor">            }                                                           \</span>
<a name="l01194"></a>01194 <span class="preprocessor">            _k_f = _k_f-&gt;next;                                          \</span>
<a name="l01195"></a>01195 <span class="preprocessor">        }                                                               \</span>
<a name="l01196"></a>01196 <span class="preprocessor">    } while (0)</span>
<a name="l01197"></a>01197 <span class="preprocessor"></span>
<a name="l01210"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa160913519a021ded8188af193538b99">01210</a> <span class="preprocessor">#define dclnk_select_sort(_begin, _end, greater, type, member) do { \</span>
<a name="l01211"></a>01211 <span class="preprocessor">        dclnk_iter _k_e = (_end);                                   \</span>
<a name="l01212"></a>01212 <span class="preprocessor">        dclnk_iter _k_i = (_begin);                                 \</span>
<a name="l01213"></a>01213 <span class="preprocessor">        dclnk_iter _k_j = _k_i-&gt;next;                               \</span>
<a name="l01214"></a>01214 <span class="preprocessor">        while (_k_j != _k_e) {                                      \</span>
<a name="l01215"></a>01215 <span class="preprocessor">            dclnk_iter _k_m = _k_i;                                 \</span>
<a name="l01216"></a>01216 <span class="preprocessor">            while (_k_j != _k_e) {                                  \</span>
<a name="l01217"></a>01217 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);    \</span>
<a name="l01218"></a>01218 <span class="preprocessor">                type * _k_pm = container_of(_k_m, type, member);    \</span>
<a name="l01219"></a>01219 <span class="preprocessor">                if (greater(_k_pm, _k_pj))                          \</span>
<a name="l01220"></a>01220 <span class="preprocessor">                    _k_m = _k_j;                                    \</span>
<a name="l01221"></a>01221 <span class="preprocessor">                _k_j = _k_j-&gt;next;                                  \</span>
<a name="l01222"></a>01222 <span class="preprocessor">            }                                                       \</span>
<a name="l01223"></a>01223 <span class="preprocessor">            if (_k_i != _k_m) {                                     \</span>
<a name="l01224"></a>01224 <span class="preprocessor">                dclnk_iter _k_t = _k_m;                             \</span>
<a name="l01225"></a>01225 <span class="preprocessor">                _k_m = _k_i;                                        \</span>
<a name="l01226"></a>01226 <span class="preprocessor">                _k_i = _k_t;                                        \</span>
<a name="l01227"></a>01227 <span class="preprocessor">                dclnk_iter_swap(_k_m, _k_i);                        \</span>
<a name="l01228"></a>01228 <span class="preprocessor">            }                                                       \</span>
<a name="l01229"></a>01229 <span class="preprocessor">            _k_i = _k_i-&gt;next;                                      \</span>
<a name="l01230"></a>01230 <span class="preprocessor">            _k_j = _k_i-&gt;next;                                      \</span>
<a name="l01231"></a>01231 <span class="preprocessor">        }                                                           \</span>
<a name="l01232"></a>01232 <span class="preprocessor">    } while (0)</span>
<a name="l01233"></a>01233 <span class="preprocessor"></span>
<a name="l01246"></a><a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga42b0a616f4ea695e408ec026c0e5aa66">01246</a> <span class="preprocessor">#define dclnk_insert_sort(_begin, _end, greater_equal, type, member) do {\</span>
<a name="l01247"></a>01247 <span class="preprocessor">        dclnk_iter _k_e = (_end);                                       \</span>
<a name="l01248"></a>01248 <span class="preprocessor">        dclnk_iter _k_f = (_begin);                                     \</span>
<a name="l01249"></a>01249 <span class="preprocessor">        dclnk_iter _k_i = _k_f-&gt;next;                                   \</span>
<a name="l01250"></a>01250 <span class="preprocessor">        for (_k_f = _k_f-&gt;prev; _k_i != _k_e; _k_i = _k_i-&gt;next) {      \</span>
<a name="l01251"></a>01251 <span class="preprocessor">            type * _k_pi = container_of(_k_i, type, member);            \</span>
<a name="l01252"></a>01252 <span class="preprocessor">            dclnk_iter _k_j = _k_f-&gt;next;                               \</span>
<a name="l01253"></a>01253 <span class="preprocessor">            while (_k_j != _k_i) {                                      \</span>
<a name="l01254"></a>01254 <span class="preprocessor">                type * _k_pj = container_of(_k_j, type, member);        \</span>
<a name="l01255"></a>01255 <span class="preprocessor">                if (greater_equal(_k_pj, _k_pi)) {                      \</span>
<a name="l01256"></a>01256 <span class="preprocessor">                    dclnk_iter _k_t = _k_i;                             \</span>
<a name="l01257"></a>01257 <span class="preprocessor">                    _k_i = _k_i-&gt;prev;                                  \</span>
<a name="l01258"></a>01258 <span class="preprocessor">                    dclnk_erase(_k_t);                                  \</span>
<a name="l01259"></a>01259 <span class="preprocessor">                    dclnk_insert(_k_j, _k_t);                           \</span>
<a name="l01260"></a>01260 <span class="preprocessor">                    break;                                              \</span>
<a name="l01261"></a>01261 <span class="preprocessor">                }                                                       \</span>
<a name="l01262"></a>01262 <span class="preprocessor">                _k_j = _k_j-&gt;next;                                      \</span>
<a name="l01263"></a>01263 <span class="preprocessor">            }                                                           \</span>
<a name="l01264"></a>01264 <span class="preprocessor">        }                                                               \</span>
<a name="l01265"></a>01265 <span class="preprocessor">    } while (0)</span>
<a name="l01266"></a>01266 <span class="preprocessor"></span>
<a name="l01269"></a>01269 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l01270"></a>01270 <span class="preprocessor"></span>}
<a name="l01271"></a>01271 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l01272"></a>01272 
<a name="l01273"></a>01273 <span class="preprocessor">#endif </span><span class="comment">/* #ifndef __NV_DCLNK__ */</span>
<a name="l01274"></a>01274 
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>数据结构</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>文件</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>类型定义</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>宏定义</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated at 2015年七月16日 星期四 12:00:37 for Navo Portable Library by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>
